package com.example.demo.common.producer;

import com.example.demo.config.TopicFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Service;

/**
 * @AUTHOR LYF
 * @DATE 2022/2/13
 * @VERSION 1.0
 * @DESC
 */
@Service
public class MqTopicProducer {
    @Autowired
    JmsMessagingTemplate jmsMessagingTemplate;
    @Autowired
    TopicFactory topicFactory;
    public void pub(){
        jmsMessagingTemplate.convertAndSend(topicFactory.createTopic("dept1-topic"),
                "1");
    }
}
